#!/bin/bash
i=1
exec 3<ip
while read -u3 line
do
        hostip=`echo $line | awk '{print $1}'`
        password=`echo $line | awk '{print $2}'`
       # password=Shsnc_2017
       # password=Shsnc_2015

        echo -------No.$i 主机IP： $hostip  ------------
        sshpass -p  ${password}   scp  -r  -o StrictHostKeyChecking=no run  ampmon@$hostip:/home/ampmon/
        #sshpass -p  ${password}   rsync -avRz  run  ampmon@$hostip:/home/ampmon
        #[ `echo $?` -eq 0 ]

        sshpass -p  ${password} ssh -o StrictHostKeyChecking=no ampmon@$hostip "cd /home/ampmon/run && sh /home/ampmon/run/a"
        [ `echo $?` -eq 0 ]
        let "i++"
done
exec 3<&-
